package com.yihu.wlyy.repository;

import com.yihu.wlyy.entity.WlyyPeopleNum;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

/**
 * Created by lyr on 2016/08/18.
 */
public interface PeopleNumDao extends PagingAndSortingRepository<WlyyPeopleNum, String>, JpaSpecificationExecutor<WlyyPeopleNum> {

    @Query("select a.num from WlyyPeopleNum a where a.code = ?1 and a.year = (select max(b.year) from WlyyPeopleNum b where b.code = ?1)")
    int findPeopleNumByCode(String code);
}
